import * as user from './controller'
import { ensureUser } from '../../middleware/validators'

export const baseUrl = '/user'

export default [{
        method: 'POST',
        route: '/',
        handlers: [user.createUser]
    },
    {
        method: 'GET',
        route: '/',
        handlers: [ensureUser, user.getUsers]
    },
    {
        method: 'GET',
        route: '/:id',
        handlers: [ensureUser, user.getUser]
    },
    {
        method: 'PUT',
        route: '/:id',
        handlers: [ensureUser, user.getUser, user.updateUser]
    },
    {
        method: 'DELETE',
        route: '/:id',
        handlers: [ensureUser, user.getUser, user.deleteUser]
    }
]